package org.black.missedCall2.reply;

import java.util.List;

import org.black.missedCall2.R;
import org.black.missedCall2.reply.dataModel.BaseReplyListDataModel;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ReplyListAdapter extends BaseAdapter {
	private LayoutInflater layoutInflater;
	private List<BaseReplyListDataModel> data;

	private static class ViewHolder {
		TextView name;
		TextView phone;
	}

	public ReplyListAdapter(Context context, List<BaseReplyListDataModel> data) {
		this.layoutInflater = LayoutInflater.from(context);
		this.data = data;
	}

	@Override
	public int getCount() {
		return this.data.size();
	}

	@Override
	public Object getItem(int position) {
		return this.data.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = null;
		if (convertView == null) {
			viewHolder = new ViewHolder();
			convertView = this.layoutInflater.inflate(R.layout.reply_list_row,
					null);
			convertView.findViewById(R.id.replyListFromTextView).setSelected(
					true);
			//viewHolder.name = convertView.fi
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		return convertView;
	}

}
